//
// COLUMN SPAN WIDTH
// =================
// Returns the width of a specified column span
//

$base--col-total ?= 12
$grid--gutter ?= 20px
$base--max-width ?= 1180px

col-span-width($col-span, $col-total = $base--col-total, $col-gutter = $grid--gutter, $max-width = $base--max-width)

  // Check gutter and max-width units match, but allow $col-gutter to be `0`
  if (unit($col-gutter) != '' && unit($col-gutter) != unit($max-width))
    error('Mismatched unit types for provided for col-span-width: ' + $col-gutter + ', ' + $max-width)

  round(($max-width + $col-gutter) * $col-span / $col-total - $col-gutter, 3)
